function update_results()
{

    $('#search_results').html('')
    url = "http://api1.asos.com/productlisting/search/"+$("#search_box").val()+"/2/PriceDescending/en_API/GBP?api_key=qwc2m87c54p9c2fusd73fecd";
    $.getJSON(url,
    function(data) {
          var items = [];
         
          var listings = data['Listings']          
          $.each(listings, function(key, val) {
            items.push('<div class="inline">');

            if ((val['ProductImageUrl']).length > 0)
            {
              items.push('<div id="image_' + key + '"><img src="' + val['ProductImageUrl'][0] + '"></div>');
            }
            items.push('<div id="title_' + key + '">' + val['Title'] + '</div>');
            items.push('<div id="price' + key + '">' + val['CurrentPrice'] + '</div>');

            items.push('</div>');
          });
         
          $('<div/>', {
            html: items.join('')
          }).appendTo($('#search_results'));
    });
}


$(document).ready(function(){
        update_results(); 
      $("#search_button").click(function() {
        update_results(); 
    });
});
